/**
 * losenote.com Inc.
 * Copyright (c) 2013-2013 All Rights Reserved.
 */
package com.losenote.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import com.losenote.base.template.AbstractServiceImpl;
import com.losenote.base.template.BlankCallback;
import com.losenote.core.UserComponent;
import com.losenote.model.UserInfo;
import com.losenote.service.UserService;
import com.losenote.service.result.UserInfoResult;

/**
 * 用户操作
 * 
 * @author danjingyu
 * @version $Id: UserServiceImpl.java, v 0.1 2013-10-31 上午10:06:39 danjingyu Exp $
 */
public class UserServiceImpl extends AbstractServiceImpl implements UserService {

    /**用户信息*/
    @Autowired
    private UserComponent  userComponent;
    
    /** 
     * @see com.losenote.service.UserService#queryById(int)
     */
    @Override
    public UserInfoResult queryById(final int userId) {
        return serviceTemplate.executeWithoutTransaction(UserInfoResult.class, new BlankCallback() {

            public UserInfoResult executeService() {
                //【1】查询
                UserInfo userInfo = userComponent.queryById(userId);

                //【2】构造结果
                UserInfoResult result = new UserInfoResult(userInfo);

                //【3】返回
                return result;
            }

        });
    }
    public void setUserComponent(UserComponent userComponent) {
        this.userComponent = userComponent;
    }
    
    

}
